package cn.itcast.account.service;

import cn.itcast.account.entity.AccountFreeze;
import com.baomidou.mybatisplus.extension.service.IService;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * @author Xiao
 * @version 1.0
 * @description 账户冻结：TCC接口
 * @date 2021/11/16
 */
@LocalTCC   //TCC接口
public interface AccountFreezeService extends IService<AccountFreeze> {
    @TwoPhaseBusinessAction(name = "deduct", commitMethod = "confirm", rollbackMethod = "cancel")
    void deduct(@BusinessActionContextParameter(paramName = "userId") String userId,
                @BusinessActionContextParameter(paramName = "money") int money);

    Boolean confirm(BusinessActionContext context);

    Boolean cancel(BusinessActionContext context);
}
